<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTasksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tasks', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("user_id", 0, 1)->comment("用户ID");
            $table->integer("project_id", 0, 1)->comment("项目ID");
            $table->tinyInteger("action")->default("0")->comment("0全新上线，1回滚");
            $table->tinyInteger("status")->default("0")->comment("状态，0：新建提交，1上线完成，2上线失败");
            $table->string("title")->nullable()->default("")->comment("上线标题");
            $table->string("link_id")->nullable()->default("")->comment("上线的软链号");
            $table->string("ex_link_id")->nullable()->default("")->comment("上一次上线的软链号");
            $table->tinyInteger("enable_rollback")->default("1")->comment("能否回滚此版本，0：否，1：是");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tasks');
    }
}
